<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 求1---100的和
        // 1 + 2 + 3 + 4 + 5 + 6...+ 100 = 5050
        // 0 + 1 = 1
        // 1 + 2 = 3
        // 3 + 3 = 6
        // 6 + 4 = 10
        // 10 + 5 = 15
        var sum = 0;
        for (var i = 1; i <= 100; i++) {
            // sum = sum + i;
            if (i % 2 == 1){
            console.log(i + "是奇数");
            // sun += i;
        }
        if (i % 2 == 0) {
            console.log(i + "是偶数");
            // sum += i;
        }
        if (i % 3 == 0) {
            console.log(i + "是3的倍数");
            // sum += i;
        }
            sum += i;
            // console.log(i);
        }
        console.log(sum);
    </script>
</body>

</html>